package com.xyf.testJPA.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.xyf.testJPA.bean.Teacher;

public interface TeacherDao extends JpaRepository<Teacher, Integer>{
	@Modifying//需要更改表数据的需要加上这个注解
	@Query(value="delete from Teacher where id=?")
	public void deletebyid2(int id);
	
	//更新字段没有自带的方法,只能自己写了 ,随便命名就需要写jpql语句 
	@Query(value="update Teacher set sex=:sex where id=:id")
	public void updateTeacherSex(@Param("id")Integer id ,@Param("sex")boolean sex);
	
	
}
